


<!DOCTYPE html>
<html id="htmlId">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
  <title>Coverage Report > BUserServiceImpl</title>
  <style type="text/css">
    @import "../../css/coverage.css";
    @import "../../css/idea.min.css";
  </style>
  <script type="text/javascript" src="../../js/highlight.min.js"></script>
  <script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>

<body>
<div class="content">
<div class="breadCrumbs">
Current scope:     <a href="../../index.html">all classes</a>
    <span class="separator">|</span>
    <a href="../index.html">com.ie.service.before</a>
</div>

<h1>Coverage Summary for Class: BUserServiceImpl (com.ie.service.before)</h1>

<table class="coverageStats">

<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Branch, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">BUserServiceImpl</td>
<td class="coverageStat">
  <span class="percent">
    33.3%
  </span>
  <span class="absValue">
    (1/3)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/8)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    4.3%
  </span>
  <span class="absValue">
    (1/23)
  </span>
</td>
</tr>
  <tr>
    <td class="name">BUserServiceImpl$$SpringCGLIB$$0</td>
  </tr>
<tr>
  <td class="name"><strong>Total</strong></td>
<td class="coverageStat">
  <span class="percent">
    33.3%
  </span>
  <span class="absValue">
    (1/3)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/8)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    4.3%
  </span>
  <span class="absValue">
    (1/23)
  </span>
</td>
</tr>
</table>

<br/>
<br/>


<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package com.ie.service.before;
&nbsp;
&nbsp;
&nbsp;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
&nbsp;
&nbsp;import com.ie.common.http.ResponseResult;
&nbsp;import com.ie.common.security.utils.ConfigrarionBean;
&nbsp;import com.ie.common.security.utils.JwtTokenUtil;
&nbsp;import com.ie.common.security.utils.MD5Util;
&nbsp;import com.ie.common.security.utils.RedisUtil;
&nbsp;import com.ie.entity.before.BUserEntity;
&nbsp;import com.ie.mapper.before.BUserMapper;
&nbsp;import org.springframework.beans.factory.annotation.Autowired;
&nbsp;import org.springframework.stereotype.Service;
&nbsp;
&nbsp;import java.util.HashMap;
&nbsp;import java.util.List;
&nbsp;import java.util.Map;
&nbsp;/**
&nbsp; * @author lzy
&nbsp; * @time 2025/5/26
&nbsp; */
&nbsp;@Service
<b class="fc">&nbsp;public class BUserServiceImpl extends ServiceImpl &lt;BUserMapper, BUserEntity&gt; implements BUserService {</b>
&nbsp;    @Autowired
&nbsp;    private RedisUtil redisUtil;
&nbsp;    @Autowired
&nbsp;    private JwtTokenUtil jwtTokenUtil;
&nbsp;    @Autowired
&nbsp;    private ConfigrarionBean config;
&nbsp;
&nbsp;    //注册
&nbsp;    @Override
&nbsp;    public ResponseResult&lt;Map&lt;String, String&gt;&gt; register(BUserEntity bUserEntity) {
<b class="nc">&nbsp;        bUserEntity.setBpwd(MD5Util.MD5(bUserEntity.getBpwd()));</b>
<b class="nc">&nbsp;        Long count =  lambdaQuery().eq(BUserEntity::getBemail,bUserEntity.getBemail()).count();</b>
<b class="nc">&nbsp;        if(count &gt; 0){</b>
<b class="nc">&nbsp;            return ResponseResult.getMessageResult(null,&quot;A001&quot;);</b>
<b class="nc">&nbsp;        }else if(save(bUserEntity)){</b>
<b class="nc">&nbsp;            return ResponseResult.getMessageResult(null,&quot;A002&quot;);</b>
&nbsp;        }else {
<b class="nc">&nbsp;            return ResponseResult.getMessageResult(null,&quot;A003&quot;);</b>
&nbsp;        } //密码为123456
&nbsp;    }
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;    //登录
&nbsp;    @Override
&nbsp;    public ResponseResult&lt;Map&lt;String, String&gt;&gt; login(BUserEntity bUserEntity) {
&nbsp;//        String code = (String)redisUtil.get(&quot;code&quot;);
&nbsp;        //验证码错误
&nbsp;//        if (!code.equalsIgnoreCase(bUserEntity.getCode())){
&nbsp;//            return ResponseResult.getMessageResult(null,&quot;A000&quot;);
&nbsp;//        }
&nbsp;//        lambdaQuery().eq(BUserEntity::getBemail,bUserEntity.getBemail()).eq(BUserEntity::getBpwd,MD5Util.MD5(bUserEntity.getBpwd()));
<b class="nc">&nbsp;        Long count = lambdaQuery().eq(BUserEntity::getBemail, bUserEntity.getBemail()).count();</b>
&nbsp;        //用户不存在
<b class="nc">&nbsp;        if(count == 0){</b>
<b class="nc">&nbsp;            return ResponseResult.getMessageResult(null,&quot;A001&quot;);</b>
&nbsp;        }
&nbsp;//        bUserEntity.setBemail(MD5Util.MD5(bUserEntity.getBemail()));
<b class="nc">&nbsp;        List&lt;BUserEntity&gt; list = lambdaQuery()</b>
<b class="nc">&nbsp;                .eq(BUserEntity::getBemail, bUserEntity.getBemail())</b>
<b class="nc">&nbsp;                .eq(BUserEntity::getBpwd, MD5Util.MD5(bUserEntity.getBpwd())).list();</b>
<b class="nc">&nbsp;        if(list.size() &gt; 0){</b>
<b class="nc">&nbsp;            String token = jwtTokenUtil.createToken(bUserEntity.getBemail());</b>
<b class="nc">&nbsp;            redisUtil.set(&quot;login_&quot; + bUserEntity.getBemail(),bUserEntity.getBemail(),config.getExpiration());</b>
<b class="nc">&nbsp;            HashMap&lt;String, String&gt; myres = new HashMap&lt;&gt;();</b>
<b class="nc">&nbsp;            myres.put(&quot;buserauthtoken&quot;,token);</b>
<b class="nc">&nbsp;            myres.put(&quot;bemail&quot;,bUserEntity.getBemail());</b>
<b class="nc">&nbsp;            myres.put(&quot;bid&quot;,list.get(0) + &quot;&quot;);</b>
<b class="nc">&nbsp;            return ResponseResult.getSuccessResult(myres);</b>
&nbsp;        }else {
<b class="nc">&nbsp;            return ResponseResult.getMessageResult(null,&quot;A002&quot;);</b>
&nbsp;        }
&nbsp;    }
&nbsp;}
</code>
</pre>
</div>

<script type="text/javascript">
(function() {
    var msie = false, msie9 = false;
    /*@cc_on
      msie = true;
      @if (@_jscript_version >= 9)
        msie9 = true;
      @end
    @*/

    if (!msie || msie && msie9) {
      hljs.highlightAll()
      hljs.initLineNumbersOnLoad();
    }
})();
</script>

<div class="footer">
    
    <div style="float:right;">generated on 2025-06-15 18:23</div>
</div>
</body>
</html>
